package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	Mysql
}
type Mysql struct {
	Host     string
	Post     int
	User     string
	Password string
	Dbname   string
}

var AppConf AppConfig

func Init() {
	viper.SetConfigFile("config/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&AppConf)
	if err != nil {
		panic(err)
	}
	fmt.Println("配置文件成功：", AppConf)
}
